home *** CD-ROM | disk | FTP | other *** search
- property _LegalChars, _MaxNoOfChars
-
- on getPropertyDescriptionList
- _list = [:]
- addProp(_list, #_LegalChars, [#comment: "keys allowed", #format: #string, #default: " "])
- addProp(_list, #_MaxNoOfChars, [#comment: "maximum number of chars", #format: #integer, #default: 8])
- return _list
- end
-
- on beginSprite me
- the keyboardFocusSprite = me.spriteNum
- end
-
- on keyDown me
- if the key = RETURN then
- if sprite(me.spriteNum).member.text.length = _MaxNoOfChars then
- end if
- else
- if the key = BACKSPACE then
- pass()
- else
- if the key = SPACE then
- pass()
- else
- if the keyCode = 123 then
- pass()
- else
- if the keyCode = 124 then
- pass()
- else
- if _LegalChars contains the key then
- if sprite(me.spriteNum).member.text.length < _MaxNoOfChars then
- pass()
- end if
- else
- dontPassEvent()
- end if
- end if
- end if
- end if
- end if
- end if
- end
-